<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'showBook.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style>
		body{
		  	background-image: url("images/bgcolor.png");
		}
		a{
			text-decoration: none;
		}
		span{
			display:inline-block;	
			width:auto;
			height:auto;
		}
		
		.item{
			width:800px;
			height:210px;
			padding-top:20px;
			margin:auto;
			box-sizing:border-box;
			border-bottom:1px solid #cccccc;
		}
		.bookname{
			color: #06a;
			font-size:18px;
		}
		.info{
			font-size: 14px;
  			color: #F63;
		}
		.info1{
			color: #666;
			font-size: 14px;
			font-family: "宋体";
		}
		.book_dis {
			color: #333;
			margin-left: 0;
			width: 400px;
			font-size: 14px;
			color: #fb751b;
		}
		.book_price {
			text-decoration: line-through;
			font-size: 12px;
			color: #999999;
		}
		.book_opera{
			margin-top:-5px;
		}
		.book_fav{
			margin-left:10px;
			display:inline;
		    width: 56px;
  		    height: 21px;
		}
		.book_tuan{
			display:inline;
		  	width: 56px;
  		  	height: 21px;
		}
		ul{
		  	list-style: none;
		  }
		  ul li{
		  	float:left;
		  }
		

	</style>
  </head>
  
  <body>
    <c:forEach items="${list}" var="item">
    	<div class="item">
		    	<span>
		    		<a href="details?id=${item.id}"  target="right"><img src="images/${item.image}.jpg" width="120px" height="170px" style="vertical-align: bottom;"/></a>
		    	</span>
		    	<span>
					<a href="details?id=${item.id}"  target="right"><span class="bookname">${item.bookname}</span><span class="info">随机配发</span></a><br/><br/>
		    		<span class="info1">（印）${item.author};（印）${item.author} （著） </span><br/>
		    		<br/><br/>
		    		<span>
		    			<ul>
							<li class="book_dis">VIP会员价：<b>￥${item.price}（7折）</b></li>
							<li>店铺ID：${item.sellerId}</li>
							<li class="book_opera">
								<a target="_top" class="book_fav" href="javascript:void(0)" onclick="addToCar(${item.id},${item.sellerId})"><img src="images/result_buy.jpg"/></a>
								<a target="_top" class="book_buy" href="javascript:void(0)" onclick="addToCar(${item.id})"><img src="images/result_fav.jpg"/></a>
							</li>
						</ul>
		    		</span>
		    	</span>
		    </div>
    	
    </c:forEach>
  </body>
  <script>
  	function addToCar(bookId,sellerId){
	    		var userId = <%=session.getAttribute("Id")%>;
    			alert("添加购物车成功，快去看看吧！");
    			window.location.href = "addToCarServlet?number=1&userId="+userId+"&bookId="+bookId;
	    	}
  </script>
</html>
